package com.atguigu.distributed.lock.juc;


import com.atguigu.distributed.lock.leecode.CountryEnum;

import java.util.concurrent.CountDownLatch;

public class CountDownLatchDemo {
    public static void main(String[] args) throws Exception{
        CountDownLatch countDownLatch = new CountDownLatch(6);
        for (int i = 1; i <= 6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"\t国被灭！");
                countDownLatch.countDown();
            }, CountryEnum.getCountryName(i).getMessage()).start();
        }
        countDownLatch.await();
        System.out.println(Thread.currentThread().getName()+"\t*******秦帝国，一统华夏！");
    }
}
